package com.ittony.crm.controller;

import com.ittony.crm.domain.Customer;
import com.ittony.crm.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
public class CustomerController {

    @Autowired
    private CustomerService customerService;

    @RequestMapping("workbench/customer/index.do")
    public String index() {

        return "workbench/customer/index";
    }

    @RequestMapping("workbench/customer/detailCustomer.do")
    public String detailCustomer(HttpServletRequest request,String id) {

        Customer customer = customerService.queryCustomerById(id);

        request.setAttribute("customer", customer);

        return "workbench/customer/detail";
    }
}
